package com.whp02.annotation.beanpostprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Service;

import java.beans.PropertyDescriptor;

/**
 * @author wanghp
 * @version 1.0
 * @description: TODO
 * @date 2021/1/13 16:54
 */
@Service
public class WHPInstantionAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {

	public WHPInstantionAwareBeanPostProcessor() {
		System.out.println("实例化WHPInstantionAwareBeanPostProcessor");
	}

	@Override
	public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
		System.out.println("whp-----postProcessBeforeInstantiation");
		return null;
	}

	@Override
	public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
		System.out.println("whp-----postProcessAfterInstantiation");
		return false;
	}

	@Override
	public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
		System.out.println("whp-----postProcessPropertyValues");
		return null;
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("whp-----postProcessBeforeInitialization");
		return null;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("whp-----postProcessAfterInitialization");
		return null;
	}
}
